//fruit
#include<bits/stdc++.h>
using namespace std;
int a[200010],u[200010],kn=1,n,lst,sum;
queue<int > q;
int main() {
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	for(int i=1; i<=n; i++) {
		scanf("%d",a+i);
	}
	lst=a[1];
	while(sum<n) {
		lst=-1;
		for(int i=1; i<=n; i++) {
			if(u[i]==-1)
			continue;
			if(lst!=a[i]) {
				lst=a[i];
				u[i]=-1;
				printf("%d ",i);
				sum++;
			}
		}
		printf("\n");
	}
}
//12 1 1 0 0 1 1 1 0 1 1 0 0
